#pragma once
#include <string>
#include <cstddef> // std::size_t
#include <boost/date_time/posix_time/posix_time.hpp>
#include <odb/nullable.hxx>
#include <odb/core.hxx>
#include <optional>

namespace vp_data
{
    enum class IdenrifyName
    {
        UNKONWN = 0;
        NORMAL = 1;
        ADMIN = 2;
    };

    enum class RoleType
    {
        UNKONWN = 0;
        ADMIN_SUPER = 1;
        ADMIN_NORMAL = 2;
        USER_NORMAL = 3;
        USER_GUEST = 4;
    };

    enum class UserStatus
    {
        UNKONWN = 0;
        ENABLE = 1;
        DISABLE = 2;
    };

    enum class VideoStatus
    {
        UNKONWN = 0;
        AUDITING = 1;
        ONLINE = 2;
        REJECr = 3;
        OFFLINE = 4;
        TRANSCODING = 5;
        TRANSCODE_FAILED = 6;
    }

#pragma db object table("tbl_session_meta")
    class Session
    {
    public:
          using ptr = std::shared_ptr<Session>;
        Session();
        Session(const std::string &session_id);
        Session(const std::string &session_id, const std::string &user_id);
        size_t id() const;
        void set_id(size_t id);
        const std::string &session_id() const;
        void set_session_id(const std::string &session_id);
        odb::nullable<std::string> user_id() const;
        void set_user_id(const odb::nullable<std::string> &user_id);
    private:
        friend class odb::access;
        #pragma db id auto 
        long _id;
        #pragma db unique type("varchar(64)")
        std::string _session_id;
        #pragma db unique type("varchar(64)")
        odb::nullable<std::string> _user_id;
    };

#pragma db object table("tbl_file_meta")
    class File
    {
    public:
        using ptr = std::shared_ptr<File>;
        File();
        File(const std::string &file_id, const std::string &uploader_uid, const std::string &path, size_t size, const std::string &mime);
        size_t id() const;
        void set_id(size_t id);
        const std::string &file_id() const;
        void set_file_id(const std::string &file_id);
        const std::string &uploader_uid() const;
        void set_uploader_uid(const std::string &uploader_uid);
        const std::string &path() const;
        void set_path(const std::string &path);
        size_t size() const;
        void set_size(size_t size);
        const std::string &mime() const;
        void set_mime(const std::string &mime);
    private:
        friend class odb::access; 
        #pragma db id auto
        long _id;
        #pragma db unique type("varchar(64)");
        std::string _file_id;
        #pragma db index type("varchar(64)");
        std::string _upload_user_id;
        #pragma db type("varchar(64)");
        std::string _storage_path;
        unsigned int _file_size;
        #pragma db type("varchar(16)");
        std::string _file_mime;
    };

}